#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time   : 2021/7/12 20:35
# @Author : cjw
from pydantic import BaseModel
from datetime import date as date_, datetime


class CreateData(BaseModel):
    date: date_  # 数据日期
    confirmed: int = 0  # 确诊数
    deaths: int = 0  # 死亡数
    recovered: int = 0  # 痊愈数


class CreateCity(BaseModel):
    province: str
    country: str
    country_code: str
    country_population: int


class ReadData(CreateData):
    id: int
    city_id: int
    created_at: datetime
    updated_at: datetime

    # 方便模型类的实例直接创建数据
    class Config:
        orm_mode = True


class ReadCity(CreateCity):
    id: int
    created_at: datetime
    updated_at: datetime

    class Config:
        orm_mode = True
